@extends('admin.layout.layout')

@section('content')

    <div class="layui-form"  style="padding: 20px 0 0 0;">

        {{csrf_field()}}

        <input type="hidden" name="id" value="{{$record->id}}">

        <div class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-inline">
                <input type="text" name="name" value="{{$record->name}}" lay-verify="required" placeholder="请输入账户名" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">手机号码</label>
            <div class="layui-input-inline">
                <input type="text" name="phone" value="{{$record->phone}}" lay-verify="phone" placeholder="请输入号码" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">复选框</label>
            <div class="layui-input-block">
                @foreach($roles as $role)
                    <input type="checkbox" @if(in_array($role->id,explode(',',$record->role_ids))) checked @endif name="roleIds[{{$role->id}}]" title="{{$role->name}}">
                @endforeach
            </div>
        </div>

        <div class="layui-form-item layui-form-text" style="width: 400px">
            <label class="layui-form-label">文本域</label>
            <div class="layui-input-block">
                <textarea name="beizhu" placeholder="请输入内容" class="layui-textarea">{{$record->beizhu}}</textarea>
            </div>
        </div>

        <div class="layui-form-item layui-hide">
            <input type="button" lay-submit lay-filter="LAY-submit" id="LAY-submit" value="确认">
        </div>
    </div>


@endsection

@section('js')
    <script>

        lay.use(['index','form'],function (){
            var $ = layui.$,form = layui.form;
            form.verify({
                pass: [
                    /^[\S]{6,12}$/
                    ,'密码必须6到12位，且不能出现空格'
                ]
            });
        });

    </script>

@endsection

